package com.chushouya.common.constant;

import com.general.framework.core.enums.IEnum;

/**
 * 商品类型
 */
public enum GoodsTypeEnum implements IEnum<Integer> {
    Recovery(1, "回收"),
    Sale(2, "优品");

    private final Integer value;
    private final String desc;

    GoodsTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer value() {
        return value;
    }

    @Override
    public String named() {
        return desc;
    }

    public static String getDesc(Integer value) {
        if (value == null) {
            return null;
        }
        for (GoodsTypeEnum type : values()) {
            if (value.equals(type.value)) {
                return type.desc;
            }
        }
        return "";
    }
}
